<?php

namespace App\Http\Controllers\Api;

use App\News;
use App\NewsZs;
use App\Http\Resources\NewsResource;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class NewsController extends Controller
{
    public function index(){
       $news= News::all();
       return new NewsResource($news);
    }
    public function detail($id){
        $new=News::findOrFail($id);
        return new NewsResource($new);
    }

    //以下为中山网
    public function zsIndex(){
        $news= NewsZs::all();
        return new NewsResource($news);
    }
    public function zsDetail($id){
        $new=NewsZs::findOrFail($id);
        return new NewsResource($new);
    }
}
